﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OleDB读取Access表结构
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void read_Click(object sender, EventArgs e)
        {
            string constr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=E:\\test.mdb";
            var conn = new OleDbConnection(constr);
            conn.Open();
            DataTable pTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[]{null, null, "参数", null});
            DataTable pTable1 = conn.GetSchema("Columns", new string[] { null, null, "参数", null });
            this.dataGridView1.DataSource = pTable1;
            
        }
    }
}
